package action.agent;

import org.apache.struts2.ServletActionContext;

import service.interf.IAgentBaseDef;
import action.common.MyBaseAction;

import com.opensymphony.xwork2.ModelDriven;

import dao.pojo.AgentBaseDef;

/**
 * 代理商默认基数
 * 
 * @author Administrator
 * 
 */
public class AgentBaseDefAction extends MyBaseAction<AgentBaseDef> implements
		ModelDriven<AgentBaseDef> {

	private static final long serialVersionUID = 1L;
	private IAgentBaseDef iAgentBaseDef;

	public void setiAgentBaseDef(IAgentBaseDef iAgentBaseDef) {
		this.iAgentBaseDef = iAgentBaseDef;
	}

	public AgentBaseDefAction() {
		super(AgentBaseDef.class);
	}

	public AgentBaseDef getModel() {
		return model;
	}

	/**
	 * 初始化列表
	 */
	public void get() {
		String r;
		try {
			r = iAgentBaseDef.get();
		} catch (Exception e) {
			r = errorHandle.handleErr(e);
		}
		servletHandle.writeToClient1(ServletActionContext.getResponse(), r);
	}

	/**
	 * 修改
	 */
	public void edit() {
		String r;
		try {
			r = iAgentBaseDef.edit(model.getAgentBase());
		} catch (Exception e) {
			r = errorHandle.handleErr(e);
		}
		servletHandle.writeToClient1(ServletActionContext.getResponse(), r);
	}

}
